<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>店铺管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
        function  editStatus(id,status) {
			var id = id;
			var conf=true;
			if(status==0){
				conf=confirm("确定要将该店铺开业吗？");
			}else if(status==1){
				conf=confirm("确定要将该店铺停业吗？");
			}
			if(conf){
				$.ajax({
					url : "${ctx}/sys/tbShopVerify/edit",
					async : false,
					type : "post",
					data : {
						"id" : id,
						"auditorState" : status,
					},
					success : function(data) {
						if(data.status==0){
							var id = data.id;
							var str="开业&nbsp;&nbsp;<a onclick='editStatus("+id+",1)'>停业</a>";
							$("#"+id+"").html(str);
						}else if(data.status==1){
							var id = data.id;
							var str="停业&nbsp;&nbsp;<a onclick='editStatus("+id+",0)'>开业</a>";
							$("#"+id+"").html(str);
						}
					}
				});
			}

		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/sys/tbShopVerify/">店铺列表</a></li>
		<%--<shiro:hasPermission name="sys:user:edit"><li><a href="${ctx}/sys/tbUserVerify/form">身份证审核添加</a></li></shiro:hasPermission>--%>
	</ul>
	<form:form id="searchForm" modelAttribute="tbShopVerify" action="${ctx}/sys/tbShopVerify/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>店铺状态：</label>
				<select id="box" name="status" class="input-medium">
					<option value="2">全部</option>
					<option  value="0" <c:if test="${tbShopVerify.status=='0'}"> selected</c:if> >开业</option>
					<option  value="1" <c:if test="${tbShopVerify.status=='1'}"> selected</c:if> >停业</option>
				</select>
			</li>
			<li><label>日期范围：&nbsp;</label>
				<input id="beginDate" name="beginDate" type="text" readonly="readonly" maxlength="20" class="input-mini Wdate"
					   value="<fmt:formatDate value="${tbShopVerify.beginDate}" pattern="yyyy-MM-dd"/>"
					   onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
				--&nbsp;<input id="endDate" name="endDate" type="text" readonly="readonly" maxlength="20" class="input-mini Wdate"
							   value="<fmt:formatDate value="${tbShopVerify.endDate}" pattern="yyyy-MM-dd"/>"
							   onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>&nbsp;&nbsp;
			</li>
		<%--	<li><label>结束时间：</label>
				<input name="endDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${tbShopVerify.updateTime}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</li>--%>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<span><font style="color: #00A6C7">${message1}</font></span>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
			<tr>
				<th>店铺名称</th>
				<th>店主名称</th>
				<th>地址</th>
				<th>小区</th>
				<th>详细地址</th>
				<th>店铺联系方式</th>
				<th>营业执照</th>
				<th>店铺余额</th>
				<th>审核状态</th>
			</tr>
		<c:forEach items="${page.list}" var="tbShopVerify">
			<tr align="center">
				<td>
						${tbShopVerify.name}
				</td>
				<td>
						${tbShopVerify.managerName}
				</td>
				<td>
						${tbShopVerify.provice}${tbShopVerify.city}${tbShopVerify.areas}
				</td>
				<td>
						${tbShopVerify.community}
				</td>
				<td>${tbShopVerify.address}</td>
				<td>${tbShopVerify.shopMobile}</td>
				<td>
					<a href="${tbShopVerify.bussinessLicenseImageUrl}" target="_blank">
					<img  style="width:100px; height: 85px; border: 0px;"  src="${tbShopVerify.bussinessLicenseImageUrl}" >
					</a>
				</td>
				<td>
					<a href="${ctx}/sys/tbShopVerify/mpWalletStream?id=${tbShopVerify.id}">
						<fmt:formatNumber value="${tbShopVerify.totalMoney}" pattern="0.00"/>
					</a>
				</td>
				<td >
					<c:if test="${tbShopVerify.status==0}">
						<div id="${tbShopVerify.id}">
							开业&nbsp;&nbsp;
							<a onclick="editStatus(${tbShopVerify.id},1)"  href="javascript:void(0)">停业 </a><br/><br/><br/>
						</div>
					</c:if>
					<c:if test="${tbShopVerify.status==1}">
					<div id="${tbShopVerify.id}">
						停业&nbsp;&nbsp;
						<a onclick="editStatus(${tbShopVerify.id},0)"  href="javascript:void(0)">开业 </a><br/><br/><br/>
					</div>
					</c:if>
				</td>


			</tr>
		</c:forEach>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>